import request from '../../request'
import { AxiosResponse } from 'axios'
import { LoginFrom } from '@/types/views/login'
import { ResponseData } from '@/types/api/public'
import { TableList,EditData,DepartmentInput } from '@/types/api/syssetting/department'

type ConfigType<T=ResponseData> = Promise<AxiosResponse<T>>

export const getData = (params:any):ConfigType<TableList> =>{
    params.PageIndex=params.current;
    params.PageSize=params.pageSize;
    return request({
       url:'/Department/QueryAllDepartmentTrees',
       method:'get',
       params,
        headers: {
            'Content-Type': 'application/json-patch+json'
          }
    })
}

export const getAllUserData =(params:any):ConfigType<TableList> =>{
    return request({
       url:'/User/QueryAllUsers',
       method:'get',
       params,
        headers: {
            'Content-Type': 'application/json-patch+json'
          }
    })
}

export const setDepartment = (data:DepartmentInput):ConfigType =>{
    return request({
       url:'/Department/SetDepartment',
       method:'post',
       data,
        headers: {
            'Content-Type': 'application/json-patch+json'
          }
    })
}

export const delDepartment = (params:any):ConfigType =>{
    return request({
       url:'/Department/DeleteDepartment',
       method:'get',
       params,
        headers: {
            'Content-Type': 'application/json-patch+json'
          }
    })
}
